package com.sxx.beautifulcity.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.Layout;
import android.view.View;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.PopupMenu;
import android.widget.TextView;

import com.sxx.beautifulcity.R;
import com.sxx.beautifulcity.popmenu.CommonPopMenu;

/**
 * Created by dllo on 15/10/28.
 */
public class PluckDetailActivity extends DialogBaseActivity implements View.OnClickListener {

    private WebView pluckWb;
    private String id;
    private TextView titleTv , moreTv;
    private ImageView backIV;
    private String url;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.webview_pluck);
        init();
    }

    private void init() {
        showDialog();
        Intent intent = getIntent();
        id = intent.getStringExtra("id");
        url = "http://www.365960.com/plus/api/article.php?sid=" + id;
        pluckWb = (WebView) findViewById(R.id.pluckWb);
        pluckWb.loadUrl(url);
        dismissDialog();

        titleTv = (TextView) findViewById(R.id.titleTv);
        titleTv.setText("采摘");
        backIV = (ImageView) findViewById(R.id.backIV);
        backIV.setOnClickListener(this);
        moreTv = (TextView) findViewById(R.id.moreTv);
        moreTv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                PopupMenu menu = CommonPopMenu.setHelpShopPopMenu(v , url);
            }
        });
    }

    @Override
    public void onClick(View v) {
        Intent intent = new Intent();
        intent.setClass(this , PluckActivity.class);
        startActivity(intent);
        finish();
        overridePendingTransition(R.anim.left_out, R.anim.right_into);
    }
}
